<?php
/**
 *
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.View.Layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
$aplicacionTitulo = __d('app_title','SMART DINNER');
?>
<!DOCTYPE html>
<html>
<head>
	<?php echo $this->Html->charset(); ?>
	<title>
		<?php echo $aplicacionTitulo; ?>:
		<?php echo $title_for_layout; ?>        
        </title>
	<?php        
		echo $this->Html->meta('icon');

                echo $this->Html->css('restaurante'); 

                echo $this->Html->script('jquery'); // Include jQuery library 
                echo $this->Html->script('jquery-ui-1.10.4.custom.min'); 
                echo $this->Html->script('jquery.form'); 
                echo $this->Html->css('ui-lightness/jquery-ui-1.10.4.custom.min'); 

//                echo $this->Html->script('prototype');
//                echo $this->Html->script('scriptaculous.js?load=effects');
//                echo $this->Html->script('modalbox');
//                echo $this->Html->script('jquery.modal');
//                echo $this->Html->script('site');

                echo $this->fetch('meta');
		echo $this->fetch('css');
		echo $this->fetch('script');
                
	?>

<script>
    function cambiarPosMesa(x,y,max_x, max_y) {
        var celda_ant, celda, pos_x, pos_y;

        celda = document.getElementById("celda_"+x+"_"+y);
        if(celda.innerHTML != '') {
            alert('La ubicación elegida ya está ocupada por otra mesa');
            return;
        }

        for(i=1;i<=max_x;i++) {
            for(j=1;j<=max_y;j++) {
                celda_ant = document.getElementById("celda_"+i+"_"+j);
                if (celda_ant.style.background == "yellow") {
                    celda_ant.style.background = 'beige';
                }
            }
        }
        pos_x = document.getElementById("MesaPosX");
        pos_y = document.getElementById("MesaPosY");
        celda.style.background = "yellow";

        // cambio el valor de las coordenadas
        pos_x.value = x;
        pos_y.value = y;        
        // cambio de color la celda elegida
        elem.style.background = "yellow";
    }


</script>

    
</head>
<body>
	<div id="container">
		<div id="header">	
		</div>

		<div id="content">
			<?php echo $this->Session->flash(); ?>
			<?php echo $this->fetch('content'); ?>
		</div>
		<div id="footer">
			<?php echo $this->Html->link(
					$this->Html->image('cake.power.gif', array('alt' => $cakeDescription, 'border' => '0')),
					'http://www.cakephp.org/',
					array('target' => '_blank', 'escape' => false)
				);
			?>
		</div>
	</div>
    
	<?php //echo $this->element('sql_dump'); ?>   
        <!-- scripts_for_layout -->
	<?php echo $scripts_for_layout; ?>
	<!-- Js writeBuffer -->
	<?php if (class_exists('JsHelper') && method_exists($this->Js, 'writeBuffer')) echo $this->Js->writeBuffer(); ?>
        
</body>
</html>
